<?php
namespace Home\Controller\Active;


class LuckyboxController extends ActiveBaseController
{

    public function _initialize()
    {
        parent::_initialize();
        $this->assign('title', '双11光棍节盛宴来66play海量萌妹陪你过');
        $this->assign('keywords', '66play,光棍节,双11,游戏妹子,抽宝箱,单身派对,萌妹,狗粮');
        $this->assign('description', '双十一活动期间会有大量宝箱、萌妹子放送，上镜秀单身，还有好礼相送哦');
    }

    public function index()
    {
        $this->buildHtml('index', APP_PATH.'../active/luckybox/', 'Active/luckybox/index', 'utf8');
        $this->display('Active/luckybox/index');
    }

    public function mobile()
    {
        $this->buildHtml('index', APP_PATH.'../active/luckybox/mobile/', 'Active/luckybox/mobile', 'utf8');
        $this->display('Active/luckybox/mobile');
    }

    public function winner()
    {
        $data = C('LUCKYBOX_WINNER', null, []);

        array_walk($data, function(&$value, $key) {
            $value = ['name' => $key, 'prize' => $value];
        });
        $this->assign('winners', $data);
        $html = $this->fetch('Active/luckybox/winner');
        $this->ajaxReturn(['state' => 0, 'data' => ['html' => $html]]);
    }
}